var db = require('../core/database.js');


function triggerActions(sensor_id, data) {
  db.getSensorActions(sensor_id, function(actions) {
  	for(var i = 0; i < actions.length; i++)
  	{
      console.log(sensor_id + ' -- ' + actions[i]);
    
      require('../modules/'+actions[i]+'.js').execute(data);
    }
  });
}

module.exports.process_sensor = triggerActions;
